home *** CD-ROM | disk | FTP | other *** search
- Path: ccshst05.cs.uoguelph.ca!ccshst01!thay
- From: thay@uoguelph.ca (Toby K Hay)
- Newsgroups: comp.lang.c
- Subject: Re: Getting date in UNIX
- Date: 18 Mar 1996 19:38:10 GMT
- Organization: University of Guelph
- Message-ID: <4ike32$c8n@ccshst05.cs.uoguelph.ca>
- References: <4ik447$bn7@raffles.technet.sg>
- NNTP-Posting-Host: ccshst01.cs.uoguelph.ca
- X-Newsreader: TIN [version 1.2 PL2]
-
- Leonard Sim (leonard@pacific.net.sg) wrote:
- : Can anyone please inform me how to obtain the date in UNIX C??
- : I just need the date in this format "dd/mm/yyyy". Thanks!!!
-
- I just did this for the first time using an example from my Turbo C
- reference by Herb Schildt. (Will mentioning that name start another
- long thread on his failings?)
-
- #include "time.h"
- #include "stdio.h"
- int main(void)
- { struct tm *ptr;
- time_t lt;
-
- lt = time(NULL);
- ptr = localtime(<);
- printf(asctime(ptr));
- return 0;
- }
-
- Toby Hay thay@uoguelph.ca
-
-